﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="author" content="Aowork">
    <meta name="description" content="">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no">

    <title></title>

    <link href="../css/mobile.css" rel="stylesheet" />

    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <script src="../js/zepto.min.js"></script>
    <script src="../js/zepto.swipe.js"></script>
    <script src="../js/common.js"></script>
    <script src="../js/config.js"></script>
    <script src="../js/uiExtend.js"></script>
    <script src="../js/wx_config.js"></script>

    <script type="text/javascript">
        jc.fnInit.push(function () {
            jc.ui.header.trigger("updateTitle", "我的课程");
        });
    </script>

    <script type="text/javascript">
        var myCourseData = {
            subject: "",
            pageNo: 1,
            pageSize: 10,
            over: false
        }
    </script>

    <script type="text/javascript">
        $.getJSON(window.path.gradeAndSubject, {}, function (result) {
            var categoryTabData = [];

            var data = result.data;


            for (var i = 0, l = data.subjectList.length; i < l; i++) {
                var cur = data.subjectList[i];

                var object = {};

                object.key = cur.name;
                object.value = cur.name;

                categoryTabData.push(object);
            }

            categoryTabData.unshift({ key: "全部课程", value: "", hasClass: "current" });

            jc.ui.categoryTab.trigger("setup", categoryTabData);

        });


        window.categoryTabChange = function (data) {

            myCourseData.pageNo = 1;
            myCourseData.over = false;
            myCourseData.subject = data;

            updateGradeAndSubject();
        }


    </script>


    <script type="text/javascript">

        function updateGradeAndSubject() {
            jc.ui.header.trigger("getUser", function (user) {
                myCourseData.userId = user.uid;
                myCourseData.accessToken = user.accessToken;
                $.getJSON(window.path.myCourse, myCourseData, function (result) {
                    if (result.success) {
                        jc.ui.courseHolder.filter("source=myCourse", "setup", result.data.list);
                    }
                    else {
                        window.errorRouter(result.desc);
                    }
                });
            });

        }
        jc.fnInit.push(function () {
            updateGradeAndSubject();
        });

    </script>


    <script type="text/javascript">

        window.onscroll = function () {
            var scrollTop = $(this).scrollTop();
            var scrollHeight = $(document).height();
            var windowHeight = $(this).height();
            if (scrollTop + windowHeight >= scrollHeight) {
                if (!window.myCourseData.over) {
                    window.myCourseData.pageNo = window.myCourseData.pageNo + 1;
                    $.get(window.path.myCourse, window.myCourseData, function (result) {
                        if (!result.data.list.length) {
                            window.myCourseData.over = true;
                        }
                        jc.ui.courseHolder.filter("source=myCourse", "append", result.data.list);
                    }, "json");
                }

            }
        }
    </script>

</head>
<body>

    <div data-ui="header" class="J_header">
        <div class="h_inner"></div>
    </div>


    <div data-ui="categoryTab" class="J_categoryTab">
        <div class="c_inner">
            <div class="i_title">

            </div>
        </div>
    </div>

    <div class="ptb10 bgfff bb1">

        <div data-ui="courseHolder" data-source="myCourse" data-router="home/courseDetails.html" data-keyword="title,price,label,signAmount" class="J_courseHolder">
            <div class="c_inner">

            </div>
        </div>

    </div>



    <div data-ui="footer" class="J_footer">


    </div>


    <div data-ui="nav" class="J_nav">
        <div class="n_inner">
            <div class="i_center clearfix"></div>
        </div>
    </div>




</body>
</html>
